<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>	
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@page import="com.yaodian100.mall.member.util.UserData"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 	
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib prefix="pu" uri="/WEB-INF/tld/pageutil.tld" %>

<%@page import="java.util.Date"%>
<%@page import="org.apache.commons.lang.time.DateUtils"%>
<c-rt:set var="frontContextPath" value='<%=ServerValue.getFrontContextPath()%>'/>
<c-rt:set var="discountType" value='<%=ServerValue.getDiscountType()%>'/>
<c-rt:set var="useCreditcard" value='<%=ServerValue.getUseCreditcard()%>'/>
<style>
.promo-popup{padding:10px;*padding:10px 0 10px 8px; color:#666;line-height:1.4em; }
.promo-popup h2,.promo-popup h3{font-size:15px;color:#d12e6f; margin-bottom:.8em;}
.promo-popup h3{color:#666;}
.promo-popup p{margin:.5em 0;}
.promo-popup .d-line{background:url(/images/link_dote.gif) repeat-x scroll 0 50%; padding:1px 0;}
.promo-popup ol,.promo-popup ul{margin-bottom:1em;margin-left:2em;}
.promo-popup li{list-style:decimal;}
</style>
<Style>
li.w-1of1{overflow:hidden}
</style>
<!-- 地址选单 -->
<script type="text/javascript" charset="UTF-8" src="/genJS/yaodian_zipCodCode.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.templating.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.alphanumeric.js"></script>
<script type="text/javascript">
	<%--售价(可有小数点)--%>
	jQuery.fn.ydPrice = function() {
	    return this.each(function() {
	    	$(this).keyup(function(){
				$(this).val($(this).val().replace(/[^\d\.}]/g,''));
			});
	    });
	};
	<%--只能输入正整数或0--%>
	jQuery.fn.onlyInteger = function() {
	    return this.each(function() {
	    	$(this).keyup(function(){
				$(this).val($(this).val().replace(/[^0-9]/g,''));
			});
	    });
	};
	$().ready(function() {	
		$("#chang_image").click(function(){
			$("#iv").attr("src","<%=ServerValue.getFrontContextPath()%>/servlet/imageValid.jpg?"+Math.random());
		});		
		$("#chkPinvyDialog").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 200,
			width:400,
			modal: true
		});	
		if ( "${prtFlag}" == "" ){
			<%--主商品數量檢查--%>
			if("${actionResult}" != "" && "${actionResult}"!='OK'){
				//alertDialog("库存不足",result,"",400,200);
				if("${actionResult}".indexOf('赠品 ')>0){
					$("#chkPinvyDialog > p").html("${actionResult}");
					$('#chkPinvyDialog').dialog('destroy');
					$('#chkPinvyDialog').dialog({
						closeOnEscape: false,
						open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); },
						bgiframe: true,
						width:380,
						modal: true
					});
				}else{
					//alert(result);
					$("#chkProdInvDialog > p").html("${actionResult}");
					$('#chkProdInvDialog').dialog('destroy');
					$('#chkProdInvDialog').dialog({
						closeOnEscape: false,
						open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); },
						bgiframe: true,
						width:380,
						modal: true
					});
					//alertDialog("库存不足",result,"",400,200);
				}
			}
		}
		$('#presentNotEnough').click(function(){
			location.href='<%=ServerValue.getFrontContextPath()%>/product/product.do?productId=<%=request.getParameter("itemNo")%>&z=<%=request.getParameter("categoryPath")%>';
			return false;
		});
		$('#mainProdNotEnough').click(function(){
			location.href='<%=ServerValue.getFrontContextPath()%>/product/product.do?productId=<%=request.getParameter("itemNo")%>&z=<%=request.getParameter("categoryPath")%>';
			return false;
		});						

		$("#orderCartDetailOpen").hide();
	  $("#orderCartDetailClose").show();	
	  $("#contactNameTip").hide();
		$("#addrTip").hide();
		$("#telTip").hide();
		$("#mobileTip").hide();
		$("#provinceTip").hide();
		$("#storeAreaTip").hide();
		$("#storeImageTip").hide();
		$("#paytype30").attr("disabled",true); 
		$("#mailTip").hide();	
		var receiverDataAy=$("#receiverData").val().split(",");
		if(receiverDataAy[0] != ''){
			$("#contactName").val(receiverDataAy[0]).css("color","#000");
		}
		if(receiverDataAy[1] != ''){
			$("#areaCode").val(receiverDataAy[1]);
		}
		if(receiverDataAy[2] != ''){
			$("#phone").val(receiverDataAy[2]);
		}
		if(receiverDataAy[3] != ''){
			$("#extension").val(receiverDataAy[3]);
		}
		if(receiverDataAy[4] != ''){
			$("#mobile").val(receiverDataAy[4]);
		}
		if($("#contactName").val()==''){
			$("#contactName").val("(请输入收货人姓名)").css("color","#aaa")};

		$("#contactName").focus(function(){
			if($("#contactName").val()=='(请输入收货人姓名)'){
			$("#contactName").val("").css("color","#000")};
		}).blur(function(){
			if($("#contactName").val()==''){
			$("#contactName").val("(请输入收货人姓名)").css("color","#aaa")};
		});

		//if($("#addr").val()==''){
			//$("#addr").val("(请选择门市地址)").css("color","#aaa")};

		//$("#addr").focus(function(){
		//	if($("#addr").val()=='(请选择门市地址)'){
		//	$("#addr").val("").css("color","#000")};
		//}).blur(function(){
		//	if($("#addr").val()==''){
		//	$("#addr").val("(请选择门市地址)").css("color","#aaa")};
		//});

		if($("#addr").val()!='' && $("#addr").val()!='(请选择门市地址)'){
			$("#addr").val($("#storeImage").find('option:selected').text());
			$("#district").val($("#storeArea").find('option:selected').text());
		};
		if($("#memo").val()==''){
			$("#memo").val("(非必填项目，可在此说明对商品的特殊需求，我们虽無法保證，但将努力配合您的需求。)").css("color","#aaa")};

		$("#memo").focus(function(){
			if($("#memo").val()=='(非必填项目，可在此说明对商品的特殊需求，我们虽無法保證，但将努力配合您的需求。)'){
			$("#memo").val("").css("color","#000")};
		}).blur(function(){
			if($("#memo").val()==''){
			$("#memo").val("(非必填项目，可在此说明对商品的特殊需求，我们虽無法保證，但将努力配合您的需求。)").css("color","#aaa")};
		});		

		<%--當客人無帳戶餘額,不可以勾選用我的帳戶餘額--%>
		if(parseFloat($("#myVirtualBalance").text())==0){
			$("#subVrtlBlnc").attr("disabled",true); 
			$("#chkVrtBlnc").attr('disabled',true); 
			$("#paytype40").attr("disabled",true); 
		}
		
		<%--商品重量計算--%>
		$("#showweight").click(function(){
			if($("#addCmpPd").val()!=""){
				var cmpPordId=$("#addCmpPd").val().split(",")[0];
				openDialog("商品重量計算",$("#showWeightDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/showWeight.do?cartId=${cartId}&cmpPordId="+cmpPordId),700,500);
			}else{
				openDialog("商品重量計算",$("#showWeightDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/showWeight.do?cartId=${cartId}"),700,500);
			}			
		});
		
		<%--选择折扣礼券--%>
		$("#chkCoupon").click(function(){
			$("#chkBonus").attr('checked', false);
			$("#editBonus").val('0.0');
			$("#offset").text("0元");
			initPaytype();
			initWallet();
			initGiftCard();
			if (this.checked){
				<c-rt:if test="${isBuyNow}">
				<c-rt:set scope="request" var="categoryPath">
				${cartOrders.cartOrderProducts[0].categoryPath}
				</c-rt:set>
				<%
					String categoryPath=(String)request.getAttribute("categoryPath");
					String categorySplit[]=categoryPath.split("/");
					if(categorySplit!=null){
						String categoryId=categorySplit[categorySplit.length-1];
						request.setAttribute("categoryId", categoryId);
					}
				%>
				openDialog("选择折扣礼券",$("#myCouponDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMyCoupon.do?isBuyNow=Y_${cartOrders.cartOrderProducts[0].prodId}_xx_${categoryId}"),700,500);
				</c-rt:if>
				<c-rt:if test="${!isBuyNow}">
				openDialog("选择折扣礼券",$("#myCouponDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMyCoupon.do"),700,500);
				</c-rt:if>
				ProcessCalcuTotal();
				$("#rechkCoupon").show();
			}else{
				$("#editCoupon").val('0.0');
				$("#showCpCode").val("");
				$("#allpaymsg").hide(); 
				$("input[id^='paytype']").each(function(i){
					$(this).attr("disabled", false);
					$(this).attr("checked", false);
				});
				//processBonus(0);
				ProcessCalcuTotal();
				$("#rechkCoupon").hide();
			}
			
		});	

		<%--耀点100货到付款支援区域--%>
		$("a.cssPayArrive").click(function(){
			openDialog("耀点100货到付款支援区域",$("#divPayArrive").load("/pages/CART/step02_pay_arrive.html"),700,700);			
		});

		<%--耀点100运费计算标准--%>
		$("#payPortage").click(function(){
			openDialog("耀点100运费计算标准",$("#divPayPortage").load("/pages/CART/step02_pay_portage.html"),700,360);			
		});

		<%--选择購物金--%>		
		$("#chkBonus").click(function(){
			<c-rt:if test="${discountType eq 'single'}">
			$("#chkCoupon").attr("checked",false);
			$("#editCoupon").val(0.0);
			$("#showCpCode").val("");
			ProcessCalcuTotal();
			</c-rt:if>
			initWallet();	
			initGiftCard();
			if (this.checked){
				processBonus($("#editCoupon").val());
				ProcessCalcuTotal();
				var iCanUse=parseInt($("#canUse").val(),10);			
				var iOffset=parseInt($("#offset").text(),10);
				if(iCanUse-iOffset<0){
					$("#editBonus").val(iCanUse.toFixed(1));
					$("#editOffsetBonus").text(iCanUse*parseFloat("${bonusCampaign.offsetRate}"));
					$("#offset").text(iCanUse.toFixed(1));	
					$("#offsetBonus").text(iCanUse*parseFloat("${bonusCampaign.offsetRate}"));
					ProcessCalcuTotal();		
				}
			}else{
				$("#editBonus").val('0.0');
				$("#editOffsetBonus").text('0');
				$("#offset").text("0.0");
				$("#offsetBonus").text("0");
				ProcessCalcuTotal();
			}
		});		

		$("#orderCartToggleCloseName").click(function () {
		      $("#orderCartDetailClose").hide();
		      $("#orderCartDetailOpen").show();		      
		});   
		$("#orderCartToggleOpenName").click(function () {		      
		      $("#orderCartDetailOpen").hide();
		      $("#orderCartDetailClose").show();		      
		});	

		$("#zipCode").onlyInteger();
		$("#mobile").onlyInteger();
		$("#areaCode").onlyInteger();
		$("#phone").onlyInteger();
		$("#extension").onlyInteger();
		$("#subVrtlBlnc").ydPrice();
		$("#subGiftCard").ydPrice();

		if($("#addCmpPd").val()!=""){
			var addCmpPrdArray=$("#addCmpPd").val().split(',');
			$("#tCampP").append("<tr id='trCampP'>" 
					+ "<td colspan='5' align='left' class='table-in'>"
					+ "<table border='0'>"
					+	"<tr>"
					+ "<td width='500'><p>"+addCmpPrdArray[3]+"</p></td>"
					+ "<td width='50'><span class='type-5'>满额购</span></td>"
					+ "<td width='70'>&nbsp;</td>"
					+ "<td width='85' class='txt-price'>￥" + parseFloat(addCmpPrdArray[2]).toFixed(1) + "</td>"
					+ "<td width='50'>1</td>"
					+ "<input type='hidden' id='editAmount_x'  value='" + parseFloat(addCmpPrdArray[2]).toFixed(1)+"'/>"
					+ "</tr>"
					+ "</table>"
					+ "</td>"
					+ "<td align='left' class='txt-price'>￥" + parseFloat(addCmpPrdArray[2]).toFixed(1) + "</td>"
					+ "</tr>");
		}
		
		$("#subVrtlBlnc").blur(function() {
			if($("#subVrtlBlnc").val()==""){
				$("#subVrtlBlnc2").val("0.0");
			}else{
				$("#subVrtlBlnc2").val(parseFloat($("#subVrtlBlnc").val()).toFixed(1));
			}
			
			ProcessCalcuTotal();
		});
		
	
			

			<%--全额由我的帐户余额付清--%>    
			$('input[id=paytype40]').click(function() {
				if ($('input[id=paytype40]').is(":checked") == true){
					if ( parseFloat($("#myVirtualBalance").text()) > 0 ){<%--由我的帐户余额付清--%>
	  	      if(parseFloat($("#finalTotalAmount").val())>=parseFloat($("#myVirtualBalance").text())){
	    		  	$("#subVrtlBlnc").val(parseFloat($("#myVirtualBalance").text()).toFixed(1));
	           	$("#subVrtlBlnc2").val(parseFloat($("#myVirtualBalance").text()).toFixed(1));
	          }else{
	           	$("#subVrtlBlnc").val(parseFloat($("#finalTotalAmount").val()).toFixed(1));
	           	$("#subVrtlBlnc2").val(parseFloat($("#finalTotalAmount").val()).toFixed(1));
	          }
			      $("#chkVrtBlnc").attr("checked",true); 
	          
	         	if($("#subVrtlBlnc").val()==""){
	         		$("#chkVrtBlnc").val(0.0);
		    		}else{
		    			$("#chkVrtBlnc").val($("#subVrtlBlnc").val());
		    		}
		        $("#subVrtlBlnc").attr("disabled",true); 
					}
					if ( parseFloat($("#myGiftCardBalance").text()) > 0 ){<%--由我的礼品卡付清--%>
						if(parseFloat($("#finalTotalAmount").val())>=parseFloat($("#myGiftCardBalance").text())){
	    		  	$("#subGiftCard").val(parseFloat($("#myGiftCardBalance").text()).toFixed(1));
	           	$("#subGiftCard2").val(parseFloat($("#myGiftCardBalance").text()).toFixed(1));
	          }else{
	           	$("#subGiftCard").val(parseFloat($("#finalTotalAmount").val()).toFixed(1));
	           	$("#subGiftCard2").val(parseFloat($("#finalTotalAmount").val()).toFixed(1));
	          }
			      $("#chkGiftCard").attr("checked",true); 
	          
	         	if($("#subGiftCard").val()==""){
	         		$("#chkGiftCard").val(0.0);
		    		}else{
		    			$("#chkGiftCard").val($("#subGiftCard").val());
		    		}
		        $("#subGiftCard").attr("disabled",true); 
					}
				}else{
					$("#subVrtlBlnc").val("");
					$("#subVrtlBlnc2").val(0.0);  
					$("#chkVrtBlnc").val(0.0); 
					$("#subGiftCard").val("");
					$("#subGiftCard2").val(0.0);  
					$("#chkGiftCard").val(0.0);   
				}
	    ProcessCalcuTotal();
		});


			$('input[id=paytype10]').click(function() {
	      if ($('input[id=paytype10]').is(":checked") == true){
	    	  reCalcBalance();
				}
	      ProcessCalcuTotal();
				if("on"=="<%=ServerValue.getBlockOrderPaymentType()%>"){
		      if(${member.applySource eq 'nonmember'}){
		    	  checkLoginMember("#");
		      }else{
		    	  if($("#ismobileVaild").val()=="false"){
	            	  openDialog("手机验证",$("#mobileVaildDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMobilVaild.do"),500,'auto');
	            }
		      }
				}
			});
			$('input[id=paytype20]').click(function() {
				if ($('input[id=paytype20]').is(":checked") == true){
	      	reCalcBalance();
				}
	      ProcessCalcuTotal();
	      if("on"=="<%=ServerValue.getBlockOrderPaymentType()%>"){
					if(${member.applySource eq 'nonmember'}){
				  	checkLoginMember("#");
				  }else{
				  	if($("#ismobileVaild").val()=="false"){
				    	openDialog("手机验证",$("#mobileVaildDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMobilVaild.do"),500,'auto');
			      }
				  }
				}
			});
			$('input[id=paytype30]').click(function() {
        if ($('input[id=paytype30]').is(":checked") == true){
         	if($("#mobile").val()==""){
         		alertDialog('填手机号码', '选择货到付款必须填手机号码',"",350,120);
          }
         	reCalcBalance();
         	<%--是否耀点100货到付款支援区域--%>
	    		serviceSupportMessage();
				}
        ProcessCalcuTotal();
        if("on"=="<%=ServerValue.getBlockOrderPaymentType()%>"){
     			if(${member.applySource eq 'nonmember'}){
   	  			checkLoginMember("#");
     			}else{
   	  			if($("#ismobileVaild").val()=="false"){
   		  			openDialog("手机验证",$("#mobileVaildDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMobilVaild.do"),500,'auto');
          	}
     			}
				}
			});
			$('input[id=paytype50]').click(function() {
        if ($('input[id=paytype50]').is(":checked") == true){
        	reCalcBalance();
				}
        ProcessCalcuTotal();
        if("on"=="<%=ServerValue.getBlockOrderPaymentType()%>"){
	      	if(${member.applySource eq 'nonmember'}){
		    	  checkLoginMember("#");
		      }else{
	    	  	if($("#ismobileVaild").val()=="false"){
		    		  openDialog("手机验证",$("#mobileVaildDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMobilVaild.do"),500,'auto');
            }
		      }
				}
			});
			$('input[id=paytype70]').click(function() {
				if ($('input[id=paytype70]').is(":checked") == true){
        	reCalcBalance();
				}
	    	if("on"=="<%=ServerValue.getBlockOrderPaymentType()%>"){
				  if(${member.applySource eq 'nonmember'}){
				   	  checkLoginMember("#");
				  }else{
				 	  if($("#ismobileVaild").val()=="false"){
				 		  openDialog("手机验证",$("#mobileVaildDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMobilVaild.do"),500,'auto');
			      }
				  }
				}
			});
			$('input[id=paytype80]').click(function() {
				if ($('input[id=paytype80]').is(":checked") == true){
        	reCalcBalance();
				}				
      	if("on"=="<%=ServerValue.getBlockOrderPaymentType()%>"){
	      	if(${member.applySource eq 'nonmember'}){
	    	  	checkLoginMember("#");
	      	}else{
	    	  	if($("#ismobileVaild").val()=="false"){
	    		  	openDialog("手机验证",$("#mobileVaildDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMobilVaild.do"),500,'auto');
          	}
	      	}
				}
			});
			<%--发票信息--%>
			$("#invotype01").attr("checked",true); 
			$("#invoTitle").hide();
			$('#invotype01').click(function(){
				$("#invoTitle").val("");
				$("#invoTitle").hide();
			});
			$('#invotype02').click(function(){
				$("#invoTitle").show();
			});
			
			<%--處理收货人是否輸入--%>
			$("#go_next").click(function() {
				if(isGoNext==true){
					alertDialog('订单', '订单正在处理中，稍等');
					return;
				}
				isGoNext=true;
				ProcessCalcuTotal();
				if($("#memo").val()=="(非必填项目，可在此说明对商品的特殊需求，我们虽無法保證，但将努力配合您的需求。)"){
					$("#memo").val("");
				}
				
				$("#contactNameTip").hide();
				$("#addrTip").hide();
				$("#telTip").hide();
				$("#mobileTip").hide();	
				$("#provinceTip").hide();
				$("#storeAreaTip").hide();
				$("#storeImageTip").hide();
				//$("#mailTip").hide();	
				var inputResult = saveInput("", -1, $("#contactName").val(),$("#province").val(),$("#city").val(),$("#district").val(),$("#addr").val(),$("#zipCode").val(),$("#mobile").val(),$("#areaCode").val(),$("#phone").val(),$("#extension").val());
				if(inputResult!=null && inputResult[0]=="false"){
					if(inputResult[1]!=""){
						$("#contactNameTip").show();
					}
					if(inputResult[2]!=""){
						$("#addrTip").text(inputResult[2]);
						$("#addrTip").show();
					}
					if(inputResult[3]!=""){
						//$("#telTip").text(inputResult[3]);
						//$("#telTip").show();
						$("#mobileTip").text(inputResult[3]);
						$("#mobileTip").show();
					}	
					if($("#province").find('option:selected').text()=="== 选择省 =="){
						$("#provinceTip").text("请选择省");
						$("#provinceTip").show();
					}
					if($("#storeArea").find('option:selected').text()=="请选择"){
						$("#storeAreaTip").text("请选择区域");
						$("#storeAreaTip").show();
					}
					if($("#storeImage").find('option:selected').text()=="请选择"){
						$("#storeImageTip").text("请选择地址");
						$("#storeImageTip").show();
					}
					<c-rt:if test="${member.sendEmail=='xx'}">
						$("#mail").val(jQuery.trim($("#mail").val()).toLowerCase());
	        		if($("#mail").val() == "xx"){
	        			$("#mailTip").attr("class","msg rn");
	        			$("#mailTip").html("请输入联络邮箱");
	        			//alertDialog('联络邮箱', '请输入联络邮箱',"",350,120);
	        			$("#mailTip").show();
             		isGoNext=false;
               	return false;
	        		}else if($("#mail").val().match(/.+@.+\..+/)==null || $("#mail").val().indexOf(' ')>=0 || chineseCount($("#mail").val())>0){
	        			$("#mailTip").attr("class","msg rn");
	        			if(jQuery.trim($("#mail").val())==''){
	        				$("#mailTip").html("请输入联络邮箱");
	        			}else{
	        				$("#mailTip").html("邮箱格式错误");
	        			}
	        			//isCorrect = false;
	        			//alertDialog('邮箱格式错误', '邮箱格式错误',"",350,120);
	        			$("#mailTip").show();
             		isGoNext=false;
               	return false;
	        		}
		        	$("#notice").focus();
					</c-rt:if>
				}else{
					if(isNaN(parseInt($("#mobile").val(), 10))==true && $("#mobile").val() !=""){
						$("#telTip").text("手机号码请使用半角数字");
						$("#telTip").show();
						$("#mobile").focus();
						isGoNext=false;
						return false;
					}
					if(isNaN(parseInt($("#areaCode").val(), 10))==true && $("#areaCode").val() !=""){
						$("#telTip").text("固定电话请使用半角数字");
						$("#telTip").show();
						$("#areaCode").focus();
						isGoNext=false;
						return false;
					}
					if(isNaN(parseInt($("#phone").val(), 10))==true && $("#phone").val() !=""){
						$("#telTip").text("固定电话请使用半角数字");
						$("#telTip").show();
						$("#phone").focus();
						isGoNext=false;
						return false;
					}
					if(isNaN(parseInt($("#extension").val(), 10))==true && $("#extension").val() !=""){
						$("#telTip").text("固定电话请使用半角数字");
						$("#telTip").show();
						$("#extension").focus();
						isGoNext=false;
						return false;
					}
					
					if($("#storeArea").find('option:selected').text()=="请选择"){
						$("#storeAreaTip").text("请选择区域");
						$("#storeAreaTip").show();
						isGoNext=false;
						return false;
					}
					if($("#storeImage").find('option:selected').text()=="请选择"){
						$("#storeImageTip").text("请选择地址");
						$("#storeImageTip").show();
						isGoNext=false;
						return false;
					}
						if($("#province").find('option:selected').text()=="== 选择省 =="){
							$("#provinceTip").text("请选择省");
							$("#provinceTip").show();
							isGoNext=false;
							return false;
						}		
						if($("#city").find('option:selected').text()=="== 选择城市 =="){
							$("#provinceTip").text("请选择城市");
							$("#provinceTip").show();
							isGoNext=false;
							return false;
						}
						if($("#district").find('option:selected').text()=="== 选择地区 =="){
							$("#provinceTip").text("请选择地区");
							$("#provinceTip").show();
							isGoNext=false;
							return false;
						}
						<c-rt:if test="${member.sendEmail=='xx'}">
							$("#mail").val(jQuery.trim($("#mail").val()).toLowerCase());
		        		if($("#mail").val() == "xx"){
		        			$("#mailTip").attr("class","msg rn");
		        			$("#mailTip").html("请输入联络邮箱");
		        			//alertDialog('联络邮箱', '请输入联络邮箱',"",350,120);
		        			$("#mailTip").show();
               		isGoNext=false;
                	return false;
		        		}else if($("#mail").val().match(/.+@.+\..+/)==null || $("#mail").val().indexOf(' ')>=0 || chineseCount($("#mail").val())>0){
		        			$("#mailTip").attr("class","msg rn");
		        			if(jQuery.trim($("#mail").val())==''){
		        				$("#mailTip").html("请输入联络邮箱");
		        			}else{
		        				$("#mailTip").html("邮箱格式错误");
		        			}
		        			$("#notice").focus();
		        			//isCorrect = false;
		        			//alertDialog('邮箱格式错误', '邮箱格式错误',"",350,120);
		        			$("#mailTip").show();
               		isGoNext=false;
                	return false;
		        		}
						</c-rt:if>
			      if ($('input[name=paytype]').is(":checked") == false){
							alert("请选择付款方式");
							$('#paytype50').attr("checked",true);
							$('#paytype50').focus();	
							isGoNext=false;
							return false;
						}
	        	if ( $('input[id=paytype10]').is(":checked") == true || $('input[id=paytype20]').is(":checked") == true
								|| $('input[id=paytype40]').is(":checked") == true|| $('input[id=paytype50]').is(":checked") == true|| $('input[id=paytype70]').is(":checked") == true|| $('input[id=paytype80]').is(":checked") == true){
							if("on"=="<%=ServerValue.getBlockOrderPaymentType()%>"){
					      if(${member.applySource eq 'nonmember'}){
					    	  checkLoginMember("#");
					    	  isGoNext=false;
									return false;
					      }else{
					    	  if($("#ismobileVaild").val()=="false"){
					    		  openDialog("手机验证",$("#mobileVaildDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMobilVaild.do"),500,'auto');
		            	  isGoNext=false;
										return false;
			            }
					      }
							}
						}
						if($("#useWallet").css("display") != "none"){
							alert("若要使用帐户余额，请按「确认使用」按钮，否则请反勾选。");
							$("#chkVrtBlnc").focus();
							isGoNext=false;
							return false;
						}						
						if ($("#chkVrtBlnc").attr('checked')){
							var tmpSubVB=0.0;
							if($("#subVrtlBlnc").val()==""){
            		tmpSubVB=$("#subVrtlBlnc").val(0.0);
		    			}else{
		    				tmpSubVB=parseFloat($("#subVrtlBlnc").val()).toFixed(1);
		    			}							
             	//$("#chkVrtBlnc").val(parseFloat($("#subVrtlBlnc").val()).toFixed(2));
             	$("#chkVrtBlnc").val(tmpSubVB);
             	//if(parseFloat($("#subVrtlBlnc").val())>parseFloat($("#myVirtualBalance").text())){
           	  if(parseFloat(tmpSubVB)>parseFloat($("#myVirtualBalance").text())){
								alert('您输入的金额大于帐户余额，请重新输入抵用金额。');
								$("#subVrtlBlnc").focus();
								isGoNext=false;
								return false;
							}
            } else {
             	$("#chkVrtBlnc").val(0.0);    
            };	 
            if(parseFloat($("#chkVrtBlnc").val())>parseFloat($("#finalTotalAmount").val())){
							alert('帐户余额不可大於实际应缴总金额');
							$("#subVrtlBlnc").focus();
							isGoNext=false;
							return false;
						}


            if($("#useGiftCard").css("display") != "none"){
							alert("若要使用礼品卡，请按「确认使用」按钮，否则请反勾选。");
							$("#chkGiftCard").focus();
							isGoNext=false;
							return false;
						}						
						if ($("#chkGiftCard").attr('checked')){
							var tmpSubGC=0.0;
							if($("#subGiftCard").val()==""){
								tmpSubGC=$("#subGiftCard").val(0.0);
				    	}else{
				    		tmpSubGC=parseFloat($("#subGiftCard").val()).toFixed(1);
				    	}							
				      $("#chkGiftCard").val(tmpSubGC);
				      if(parseFloat(tmpSubGC)>parseFloat($("#myGiftCardBalance").text())){
								alert('您输入的金额大于礼品卡余额，请重新输入抵用金额。');
								$("#subGiftCard").focus();
								isGoNext=false;
								return false;
							}
			      } else {
			       	$("#chkGiftCard").val(0.0);    
			      }	 
						if(parseFloat($("#chkGiftCard").val())>parseFloat($("#finalTotalAmount").val())){
							alert('礼品卡不可大於实际应缴总金额');
							$("#subGiftCard").focus();
							isGoNext=false;
							return false;
						} 	
			 
            if ($('input[id=paytype30]').is(":checked") == true){
             	if($("#mobile").val()==""){
             		alertDialog('填手机号码', '选择货到付款必须填手机号码',"",350,120);
             		isGoNext=false;
              	return false;
             	}
            }
            if ($('input[id=paytype40]').is(":checked") == true){
             	if(parseFloat($("#finalMustPay").val())>0){
               	alert('使用全额由我的帐户余额/礼券付清，但剩余应付金额大于0，请重新选择');
               	isGoNext=false;
               	return false;
							}
            }
            if(parseFloat($("#finalMustPay").val())<0){
            	alert('剩余应付金额不可为负，请重新选择');
            	isGoNext=false;
            	return false;
						}
            if(parseFloat($("#finalTotalAmount").val())<0){
            	alert('订单金额不可为负，请重新选择');
            	isGoNext=false;
            	return false;
						} 
            if(parseFloat($("#finalMustPay").val())==0){
         	 		if ($('input[id=paytype50]').is(":checked") == true){
	            	alert('剩余应付金额为0，不可选网上支付，请重新选择');
	            	isGoNext=false;
	            	return false;
           	 	}
            	if ($('input[id=paytype20]').is(":checked") == true){
              	alert('剩余应付金额为0，不可选邮局汇款，请重新选择');
              	isGoNext=false;
              	return false;
             	}
            	if ($('input[id=paytype10]').is(":checked") == true){
              	alert('剩余应付金额为0，不可选银行汇款，请重新选择');
              	isGoNext=false;
              	return false;
             	}
            	if ($('input[id=paytype30]').is(":checked") == true){
              	alert('剩余应付金额为0，不可选货到付款，请重新选择');
              	isGoNext=false;
              	return false;
             	}
						}
            if ($("#invotype02").is(":checked") == true){
	           	if($("#invoTitle").val()==""){
	             	alert('请输入单位');
	             	isGoNext=false;
	             	return false;
							}
            	if($("#invoTitle").val().length+chineseCount($("#invoTitle").val())>40){
    	    			alert("请使用 中文20个字以内 或 英文40个字以内");
    	    			isGoNext=false;
	             	return false;
    		    	}
			      }	
		        <c-rt:choose>
					    <c-rt:when test="${needValidateNum}">
		            <%--输入验证码--%>
					      if(($("#ccode").val() == "")){
					    	  	$("#ccode").focus();	
					       		$("#codeTip").html('请输入校验码');
					       		$("#codeTip").show();
					       		isGoNext=false;
										return false;
					      }else{
					    	  $.post("<%=ServerValue.getFrontContextPath()%>/shopping/jsonChkValidateNum.do",{ccode:$("#ccode").val()},
				    				ccodeCallback,"json");
					      }
					    </c-rt:when>
					    <c-rt:otherwise>
					    	$("#go_next").hide();
								$("#go_back").hide();
								$("#paymentInfoForm").submit();
								return false;
					    </c-rt:otherwise>
					  </c-rt:choose>
				}
				isGoNext=false;
			});

			function ccodeCallback(ccodeResult){
		  		if(ccodeResult == "error"){
		  			$("#ccode").focus();	
						$("#codeTip").html('验证码错误，请重新输入');
						$("#iv").attr("src","<%=ServerValue.getFrontContextPath()%>/servlet/imageValid.jpg?"+Math.random());
						$("#codeTip").show();
						isGoNext=false;
						return false;
					}else{
						<%--調整: 訂購流程_商品&赠品不足之检查--%>
						$("#go_next").hide();
						$("#go_back").hide();
						$("#paymentInfoForm").submit();
						//return true;
						return false;
					}
			}

			
			function saveInput(text, abId, iName, iProvince, iCity, iDistrict, iStreet, iZip, iMobile, iAreaCode, iPhone, iExte){
				var inputCorrect = true;
				var a_msg = new Array();
				a_msg[0]="true";

				a_msg[1]="";
				if(iName == "(请输入收货人姓名)"){
					a_msg[0]="false";
					a_msg[1]="请输入收件人姓名";
				}
				
				a_msg[2]="";
				if(iProvince == ""){
					a_msg[0]="false";
					a_msg[2]="请选择省";
				}

				//if(iZip == ""){
				//	a_msg[0]="false";
			//		if(a_msg[2].length!=0){a_msg[2]+="，";}
			//		a_msg[2]+="请输入邮编";
				//}
				if(iStreet == ""){
					a_msg[0]="false";
					if(a_msg[2].length!=0){a_msg[2]+="，";}
					a_msg[2]+="请选择门市地址";
				}

				a_msg[3]="";
				if(iMobile=="" && iPhone==""){
					a_msg[0]="false";
					a_msg[3]="请至少填写一组电话";
				}

				if(iMobile==""){
					a_msg[0]="false";
					a_msg[3]="请填手机号码";
            	}
				
				
				if(iPhone!="" && iAreaCode==""){
					a_msg[0]="false";
					a_msg[3]="请输入区码";
				}
				iStreet = iStreet.replace(/，/ig,",");
				a_msg[4] = iProvince+"，"+iCity+"，"+iDistrict+"，"+iStreet+"，"+iZip;
				if(a_msg[0]=="true"){
					a_msg[5] = "";		
					//can go next	
					return null;
				}else{
					return a_msg;
				}
			}	

			<%--計算实际应付总金额--%>
			ProcessCalcuTotal();
			

			<%--處理帳戶餘額chkVrtBlnc--%>	
			$('#chkVrtBlnc').click(function(){
				initPaytype();
				$("#subVrtlBlnc").css("background-color","white");	  
				if (this.checked){
          	$("#useWallet").show();
          	$("#subVrtlBlnc").attr("readOnly", false); 
          	if($("#subVrtlBlnc").val()==""){
          		$("#chkVrtBlnc").val(0.0);
          		$("#subVrtlBlnc2").val(0.0);
    			}else{
    				$("#chkVrtBlnc").val($("#subVrtlBlnc").val());
    				$("#subVrtlBlnc2").val($("#subVrtlBlnc").val());
    			}
          	if("on"=="<%=ServerValue.getBlockOrderPaymentType()%>"){
  			      if(${member.applySource eq 'nonmember'}){
  			    	  checkLoginMember("#");
  			      }else{
     					if($("#ismobileVaild").val()=="false"){
            	  openDialog("手机验证",$("#mobileVaildDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMobilVaild.do"),500,'auto');
	            }
 			      }
   				}
         } else {
         	initWallet();
         }
        ProcessCalcuTotal();
	    });
			$("#confirmWallet").click(function(){	  
				if($("#subVrtlBlnc").val()==""){
     			$("#chkVrtBlnc").val(0.0);
     			$("#subVrtlBlnc2").val(0.0);
    		}else{
    			 $("#chkVrtBlnc").val(parseFloat($("#subVrtlBlnc").val()).toFixed(1));
    	     $("#subVrtlBlnc2").val(parseFloat($("#subVrtlBlnc").val()).toFixed(1)); 
    		}             
        ProcessCalcuTotal();
        var tmpSVB=0.0;
	      if($("#subVrtlBlnc").val()==""){
	     		tmpSVB=0.0;
   			}else{
   				tmpSVB=$("#subVrtlBlnc").val();
   			}
        if(parseFloat($("#finalMustPay").val())<0){
	        alert("您输入的支付金额超过了订单金额，请重新输入欲支付金额。");
	        $("#subVrtlBlnc").focus();
  	    }else if(parseFloat(tmpSVB)>parseFloat($("#myVirtualBalance").text())){
					alert('您输入的金额大于帐户余额，请重新输入抵用金额。');
					$("#subVrtlBlnc").focus();
				}else if(parseFloat($("#finalMustPay").val())==0){
					$("#allpaymsg").show();    
					if( isNaN($("#subGiftCard").val()) || isNaN($("#subGiftCard2").val()) ){
						$("#chkGiftCard").attr("checked",false);
						$("#subGiftCard").val(0.0);
						$("#subGiftCard2").val(0.0);
					}				
          $("input[id^='paytype']").each(function(i){
						if(this.id=='paytype40'){
							$(this).attr("disabled", false);
							$(this).attr("checked", true);
						}else{
							$(this).attr("disabled", true);
						}
					});
          $("#useWallet").hide();
          $("#subVrtlBlnc").attr("readOnly", true);
          $("#subVrtlBlnc").css("background-color","silver");
          ProcessCalcuTotal();
        }else{  
					$("#useWallet").hide();
        	$("#subVrtlBlnc").attr("readOnly", true);
        	$("#subVrtlBlnc").css("background-color","silver");
        	ProcessCalcuTotal();
        }
      });		

			<%--處理礼品卡餘額chkGiftCard--%>	
			$('#chkGiftCard').click(function(){
				$("#subGiftCard").css("background-color","white");	  
	      if (this.checked){
	    	  initPaytype();
         	$("#useGiftCard").show();
         	$("#subGiftCard").attr("readOnly", false); 
         	if($("#subGiftCard").val()==""){
	       		$("#chkGiftCard").val(0.0);
	       		$("#subGiftCard2").val(0.0);
	  			}else{
	   				$("#chkGiftCard").val($("#subGiftCard").val());
	   				$("#subGiftCard2").val($("#subGiftCard").val());
	   			}
         	if("on"=="<%=ServerValue.getBlockOrderPaymentType()%>"){
			      if(${member.applySource eq 'nonmember'}){
			    	  checkLoginMember("#");
			      }else{
							if($("#ismobileVaild").val()=="false"){
			          openDialog("手机验证",$("#mobileVaildDialog").load("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/loadMobilVaild.do"),500,'auto');
			        }
			    	}
					}
	      }else {
	        initGiftCard();
	      }
	      ProcessCalcuTotal();
	    });
		 	$("#confirmGiftCard").click(function(){	 
			 	if($("#subGiftCard").val()==""){
      			$("#chkGiftCard").val(0.0);
      			$("#subGiftCard2").val(0.0);
   			}else{
   				 $("#chkGiftCard").val(parseFloat($("#subGiftCard").val()).toFixed(1));
   	       $("#subGiftCard2").val(parseFloat($("#subGiftCard").val()).toFixed(1)); 
   			}             
        ProcessCalcuTotal();
         //alert($("#finalMustPay").val());
         var tmpSVB=0.0;
         if($("#subGiftCard").val()==""){
        		tmpSVB=0.0;
    		}else{
    			tmpSVB=$("#subGiftCard").val();
    		}
                
        if(parseFloat($("#finalMustPay").val())<0){
           alert("您输入的支付金额超过了订单金额，请重新输入欲支付金额。");
           $("#subGiftCard").focus();
        }else if(parseFloat(tmpSVB)>parseFloat($("#myGiftCardBalance").text())){
					alert('您输入的金额大于礼品卡余额，请重新输入抵用金额。');
					$("#subGiftCard").focus();
				}else if(parseFloat($("#finalMustPay").val())==0){
					$("#allpaymsg").show();
					if( isNaN($("#subGiftCard").val()) || isNaN($("#subGiftCard2").val()) ){
						$("#chkGiftCard").attr("checked",false);
						$("#subGiftCard").val(0.0);
						$("#subGiftCard2").val(0.0);
					}
          $("input[id^='paytype']").each(function(i){
						if(this.id=='paytype40'){
							$(this).attr("disabled", false);
							$(this).attr("checked", true);
						}else{
							$(this).attr("disabled", true);
						}
					});
          $("#useGiftCard").hide();
          $("#subGiftCard").attr("readOnly", true);
          $("#subGiftCard").css("background-color","silver");
          ProcessCalcuTotal();
        }else{  
					$("#useGiftCard").hide();
       		$("#subGiftCard").attr("readOnly", true);
       		$("#subGiftCard").css("background-color","silver");
       		ProcessCalcuTotal();
        }
      });				      

		 	<%--初始可折抵的購物金--%>
				function processBonus(minusCoupon){
					var iOffset=0;
					var iCanUse=$("#canUse").val();
					if( "${not empty bonusCampaign}" && parseInt(iCanUse,10)>0){
						//var ieditTotalAmount=$("#editTotalAmount").val();
						ieditTotalAmount=sfinalTotalAmount-parseInt(minusCoupon,10);
						//iOffset=Math.round(parseInt(ieditTotalAmount,10)*30/100);
						<%--积分折抵上限--%>
						iOffset=Math.round(parseInt(ieditTotalAmount,10)*parseInt("${bonusCampaign.offsetUpperLimit}")/100);
						iOffset=parseInt(iOffset,10);
						<%--积分折抵上限不可超过可使用的积分限制--%>
						if ( iOffset > parseInt(iCanUse,10) ){
							iOffset = parseInt(iCanUse,10);
						}
						<%--可使用的积分限制不可超过订单最大可抵折积分限制--%>
						if ( iOffset > parseInt("${bonusCampaign.offsetDiscountLimit}",10)){
							iOffset = parseInt("${bonusCampaign.offsetDiscountLimit}",10);
						}
						$("#offset").text(iOffset.toFixed(1));
						$("#offsetBonus").text(iOffset*parseInt("${bonusCampaign.offsetRate}",10));
						if($("#chkBonus").attr('checked')==true){
							$("#editBonus").val(iOffset.toFixed(1));		
							$("#editOffsetBonus").text(iOffset*parseInt("${bonusCampaign.offsetRate}",10));
						}
					}else{
						$("#offset").text(iOffset.toFixed(1));
						$("#offsetBonus").text("0");
						$("#editOffsetBonus").text("0");
						$("#chkBonus").attr('disabled',true); 
					}
				}
			$("#province").change(function() {
					initWallet();
					initGiftCard();
					<%--计算运费--%>
					var tmpProvince=$("#province").find('option:selected').val();
						//setTimeout(FreightCod,400);
						FreightCod(tmpProvince);
						
			});	
			$("#district").change(function() {
				initWallet();
				initGiftCard();
				<%--判断是否可货到付款--%>
				var tmpCity=$("#city").find('option:selected').val();
				var tmpDistrict=$("#district").find('option:selected').text();
				if(tmpDistrict.substring(0,1)=='※'){
					$("#paytype30").attr("disabled",false); 
					$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
				}else{
					$("#paytype30").attr("disabled",true); 
					$("#paytype30").attr("checked",false); 
					$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
				}	
				if(parseFloat($("#editTotalAmount").val())>10000){
					$("#paytype30").attr("disabled",true);
					$("#showOrderPriceLimit").html("(订单金额超过10000元，将不提供货到付款服务。)");
				}
				serviceSupportMessage();
			});	
			
			<%--达芙妮daphne START--%>
			$("#storeArea").children().each(function(){
				var storeAreaInit=$("#storeAreaInit").val();
			    if ($(this).text()==storeAreaInit){
			        $(this).attr("selected","true"); <%--或是給selected也可--%>
			        storeAreaSelected(storeAreaInit);
			    }
			});
			
			 $("#storeArea").change(function() {
				    $("#imagePreview").html("<img src='/images/daphne/000.gif'>");
					$("#pickStore").html("");
			        var storeArea = $("option:selected", this).val();
					$.post("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/findDaphnes.do",{storeArea:storeArea},callback,"json");
					function callback(actionResult){
						if(actionResult!=null){
  						    var arr_text = actionResult.split("$");										
							var options = '<option value="">请选择</option>';
							 for(i=0;i<arr_text.length;i++)
							 {
								 v=arr_text[i].split(",");
								options += '<option value="' + v[0] + '">' + v[1] + '</option>';
							}
							$("#storeImage").html(options);
							$('#storeImage option:first').attr('selected', 'selected');
						}	
					}
					if($("#storeArea").find('option:selected').text()=="请选择"){
						var options = '<option value="">请选择</option>';
						$("#storeImage").html(options);
					}
					
			   });	

				function storeAreaSelected(storeAreaInit){
					 var storeArea = storeAreaInit;
					 var storeId =$("#storeId").val();
						$.post("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/findDaphnes.do",{storeArea:storeArea},callback,"json");
						function callback(actionResult){
							if(actionResult!=null){
							    var arr_text = actionResult.split("$");										
								var options = '<option value="">请选择</option>';
								 for(i=0;i<arr_text.length;i++)
								 {
									 v=arr_text[i].split(",");
											if(storeId == v[0]){
												options += '<option value="' + v[0] + '" selected="selected">' + v[1] + '</option>';
											}else{
												options += '<option value="' + v[0] + '">' + v[1] + '</option>';	
											}	
										
								}
								$("#storeImage").html(options);
								if(storeId == ""){
									$('#storeImage option:first').attr('selected', 'selected');
								}else{
									$("#imagePreview").html(storeId ? "<img src='/images/daphne/" + storeId + ".jpg'>" : "<img src='/images/daphne/000.gif'>");
									$("#pickStore").html("上海市，"+$("#storeArea").find('option:selected').text()+"，"+$("#storeImage").find('option:selected').text());
									$("#addr").val($("#storeImage").find('option:selected').text());
									$("#district").val($("#storeArea").find('option:selected').text());
								}
							}	
						}
				}

			 $("#storeImage").change(function() {
				var tmpstoreArea=$("#storeArea").find('option:selected').text();
				 var storeId = $("option:selected", this).val();
				$("#imagePreview").html(storeId ? "<img src='/images/daphne/" + storeId + ".jpg'>" : "<img src='/images/daphne/000.gif'>");
				if($("option:selected", this).text()=="请选择"){
					$("#pickStore").html("未选取");
					$("#addr").val("");
				}else{
					$("#pickStore").html("上海市，"+tmpstoreArea+"，"+$("option:selected", this).text());
					$("#addr").val($("option:selected", this).text());
				}
				$("#district").val(tmpstoreArea);
				$("#storeId").val(storeId);
			 });		 
			<%--达芙妮daphne END--%>	    
			 $("#iv").attr("src","<%=ServerValue.getFrontContextPath()%>/servlet/imageValid.jpg?"+Math.random());
	});
	function FreightCod(tmpProvince){
		var addCmpPd=$("#addCmpPd").val();
		var tmpFinalMustPay=$("#editTotalAmount").val();
		var buyNowCartId=$("#buyNowCartId").val();
		if(parseFloat($("#finalTotalAmount").val())>10000){
			$("#paytype30").attr("disabled",true);
			$("#paytype30").attr("checked",false);
			$("#showOrderPriceLimit").html("(订单金额超过10000元，将不提供货到付款服务。)");
			
			caleShipFare(tmpProvince,"N",tmpFinalMustPay,addCmpPd,buyNowCartId);		
		
		}else{
			var tmpDistrict=$("#district").find('option:selected').text();
			if(tmpDistrict.substring(0,1)=='※'){
				$("#paytype30").attr("disabled",false); 
				$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
			}else{
				$("#paytype30").attr("disabled",true); 
				$("#paytype30").attr("checked",false);
				$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
			}
			caleShipFare(tmpProvince,"N",tmpFinalMustPay,addCmpPd,buyNowCartId);		
		
			clearTimeout;	
		}
	}
	function callback(result){
		$("#spanFreight").text(result);
		$("#editShipFare").val(parseFloat(result).toFixed(1));
		ProcessCalcuTotal();
	}	
	<c-rt:set scope="request" var="totalPrice" value="0"/>
	<c-rt:forEach items="${cartOrders.cartOrderProducts}" var="cop">
 
  		<c-rt:set var="copDiscount" value="${cop.discount}" scope="request"/>
  		<c-rt:if test="${!empty totalDiscount}">
  		<c-rt:set scope="request" var="totalDiscount" value="${pu:toFloat(totalDiscount)+pu:toFloat(copDiscount)}"/>
  		</c-rt:if>
  		<c-rt:if test="${empty totalDiscount}">
  		<c-rt:set scope="request" var="totalDiscount" value="${copDiscount}"/>
  		</c-rt:if>
		<c-rt:set scope="request" var="totalPrice" value="${pu:toFloat(totalPrice)+pu:toFloat(cop.totalPrice)}"/>

  </c-rt:forEach>	
  var totalDiscount='${cartOrders.discount}';
  if(totalDiscount==''){
	  totalDiscount=0.0;
  }else{

	  totalDiscount=parseFloat(totalDiscount);
	
  }
  var totalPrice='${totalPrice}';
  if(totalPrice=='')totalPrice=0.0;
  var sfinalTotalAmount=0.0;
	function ProcessCalcuTotal(){
		<%--购物金的计算规则(商品总额-折扣)--%>
		sfinalTotalAmount=calcuTotal(parseFloat(totalPrice)-totalDiscount,0,0,$("#editBonus").val());
		var sumAmount=0.0;
		$("input[id*='editAmount_']").each(function(){	
			sumAmount=parseFloat(sumAmount)+parseFloat($(this).val());
			sumAmount =sumAmount.toFixed(1);
		});
		$("#editTotalAmount").val(sumAmount);	<%--合计金额--%>
		
		finalTotalAmount=calcuTotal(sumAmount-totalDiscount,$("#editShipFare").val(),$("#editCoupon").val(),$("#editBonus").val());
		if(finalTotalAmount<0)finalTotalAmount=$("#editShipFare").val();
		
		$("#finalTotalAmount").val(finalTotalAmount);	<%--实际应付总金额-订单明细-关闭订单明细--%>
		$("#pTotalAmount").text($("#editTotalAmount").val());<%--付款方式-商品合计金额--%>
		$("#pCoupon").text($("#editCoupon").val());<%--付款方式-礼券--%>
		$("#pBonus").text($("#editBonus").val());<%--付款方式-积分金额--%>
		$("#pOffsetBonus").text($("#editOffsetBonus").text());<%--付款方式-积分--%>
		$("#pShipFare").text($("#editShipFare").val());<%--付款方式-运费--%>
		if ( $("#chkGiftCard").attr("checked") && $("#useGiftCard").is(':hidden') ){
			if ( "" == $("#subGiftCard").val() ){
				$("#pGiftCard").text(0.0);
			}else{
				$("#pGiftCard").text($("#subGiftCard").val());<%--付款方式-礼品卡--%>
			}
		}else{
			$("#pGiftCard").text(0.0);
		}
		if ( $("#chkVrtBlnc").attr("checked") &&  $("#useWallet").is(':hidden') ){
			if ( "" == $("#subVrtlBlnc").val() ){
				$("#pVirtualBalance").text(0.0);
			}else{
				$("#pVirtualBalance").text($("#subVrtlBlnc").val());<%--付款方式-帐户余额--%>
			}
		}else{
			$("#pVirtualBalance").text(0.0);
		}		
		if(totalDiscount==0){
			$('#pDiscount').text(totalDiscount);
			$('#totalDiscount').attr('value', totalDiscount);
		}else{
			$('#pDiscount').text(totalDiscount.toFixed(1));
			$('#totalDiscount').attr('value', totalDiscount.toFixed(1));
		}
		$("#pFinalTotalAmount").text((finalTotalAmount-parseFloat($("#pVirtualBalance").text())-parseFloat($("#pGiftCard").text())).toFixed(1));<%--付款方式-订单金额--%>		
		var iMustPay=parseFloat(finalTotalAmount)-parseFloat($("#subVrtlBlnc2").val())-parseFloat($("#subGiftCard2").val());
		iMustPay=iMustPay.toFixed(1);
		$("#finalMustPay").val(iMustPay);<%--剩余应付金额--%>
		$("#closeFinalTotalAmount").val(iMustPay);	<%--实际应付总金额-订单明细-开启订单明细--%>

		<%--使用禮券付清全額，且無運費、cod手續費--%>
		if ( parseFloat(iMustPay) == 0 && parseFloat($("#pShipFare").text()) == 0 && parseFloat($("#subVrtlBlnc2").val()) == 0 && 
				parseFloat($("#subGiftCard2").val()) == 0 && parseFloat($("#pDiscount").text()) == 0 && parseFloat($("#pBonus").text()) == 0 &&
				parseFloat($("#pGiftCard").text()) == 0 && parseFloat($("#pVirtualBalance").text()) == 0 &&
				parseFloat($("#pCoupon").text()) > 0 ){
				$("#allpaymsg").show(); 
				$("input[id^='paytype']").each(function(i){
					if(this.id=='paytype40'){
						$(this).attr("disabled", false);
						$(this).attr("checked", true);
					}else{
						$(this).attr("disabled", true);
						$(this).attr("checked", false);
					}
				});
		}
		if ( parseFloat(iMustPay) != 0 ){
			if(parseFloat($("#finalTotalAmount").val())>10000){
				$("#paytype30").attr("disabled",true);
				$("#paytype30").attr("checked",false);
				$("#showOrderPriceLimit").html("(订单金额超过10000元，将不提供货到付款服务。)");
			}else{
				var tmpDistrict=$("#district").find('option:selected').text();
				if(tmpDistrict.substring(0,1)=='※'){
					$("#paytype30").attr("disabled",false); 
					$("#showOrderPriceLimit").html("(需加收手续费 5 元，推广期暂不收。)");
				}else{
					$("#paytype30").attr("disabled",true); 
					$("#paytype30").attr("checked",false); 
				}
			}
		}
	}
	function calcuTotal(sumAmount,shipFare,coupon,bonus){
		var fTotal=0.0;
		fTotal=parseFloat(sumAmount)+parseFloat(shipFare)-parseFloat(coupon)-parseFloat(bonus);

		fTotal =fTotal.toFixed(1);
		return fTotal;
	}

	function initWallet(){
		$("#useWallet").hide();
		$("#subVrtlBlnc").attr("readOnly", true); 
		$("#subVrtlBlnc").css("background-color","silver");
		$("#allpaymsg").hide();    	
		$("#chkVrtBlnc").attr('checked', false);
		$("#chkVrtBlnc").val(0.0);  
   	$("#subVrtlBlnc2").val(0.0);
 		$("#subVrtlBlnc").val("");
    ProcessCalcuTotal();
		if(parseFloat($("#finalMustPay").val())!=0){
			$("input[id*='paytype']").each(function(i){
				if(this.id=='paytype40'){
					$(this).attr("disabled", true);
					$(this).attr("checked", false);
				}else{
					$(this).attr("disabled", false);
				}
			});
			ProcessCalcuTotal();
		}    
	}

	function initGiftCard(){
		$("#useGiftCard").hide();
		$("#subGiftCard").attr("readOnly", true); 
		$("#subGiftCard").css("background-color","silver");
		$("#allpaymsg").hide();    	
		$("#chkGiftCard").attr('checked', false);
		$("#chkGiftCard").val(0.0);  
   	$("#subGiftCard2").val(0.0);
 		$("#subGiftCard").val("");
    ProcessCalcuTotal();
    if(parseFloat($("#finalMustPay").val())!=0){
			$("input[id*='paytype']").each(function(i){
				if(this.id=='paytype40'){
					$(this).attr("disabled", true);
					$(this).attr("checked", false);
				}else{
					$(this).attr("disabled", false);
				}
			});
			ProcessCalcuTotal();
		}    
	}
	
<c-rt:if test="${campProductWeight!=null}">
<c-rt:set var="totalWeight" value="${campProductWeight}" scope="request"/>
</c-rt:if>
<c-rt:if test="${campProductWeight==null}">
<c-rt:set var="totalWeight" value="0" scope="request"/>
</c-rt:if>
<c-rt:forEach items="${cartOrders.cartOrderProducts}" var="op">
	<c-rt:forEach items="${op.details}" var="opd">
		<c-rt:set var="totalWeight" scope="request">
			${pu:toFloat(totalWeight)+opd.qty*opd.weight}
		</c-rt:set>
	</c-rt:forEach>
</c-rt:forEach>
<c-rt:set var="totalWeight" value="${pu:toFloat(totalWeight)/1000}" scope="request"/>
	<%--是否耀点100货到付款支援区域--%>
	function serviceSupportMessage(){
    	$('#dialog').addClass('ui-dialog-content ui-widget-content COD-area');
    	$.each(districtSvieArray,function(index, item){
			var selectDistrict =$("#district").find('option:selected').val();
			var chkPaytype30=$('input[id=paytype30]').is(":checked");
			if ( item.When == selectDistrict && chkPaytype30 == true ){
				var msage="<table class='tb-p01'>"; 
				msage=msage+"<tr>"; 
				msage=msage+"<th colspan='2'>县区</th>"; 
				msage=msage+"</tr>"; 
				msage=msage+"<tr>"; 
				msage=msage+"<td class='sec-th'>可服务区域</td> ";
				msage=msage+"<td>"+item.Value+"</td> ";
				msage=msage+"</tr> ";
				msage=msage+"<tr>"; 
				msage=msage+"<td class='sec-th'>不可服务区域</td>"; 
				msage=msage+"<td>"+item.Text+"</td>"; 
				msage=msage+"</tr>"; 
				msage=msage+" </table>"; 
				alertDialog('货到付款服务地区', msage,"",600,'auto');
			}
		});
	}	
	<%--是否耀点100货到付款支援区域--%>
	function serviceSupportMessage(){
    	$('#dialog').addClass('ui-dialog-content ui-widget-content COD-area');
    	$.each(districtSvieArray,function(index, item){
			var selectDistrict =$("#district").find('option:selected').val();
			var chkPaytype30=$('input[id=paytype30]').is(":checked");
			if ( item.When == selectDistrict && chkPaytype30 == true ){
				var msage="<table class='tb-p01'>"; 
				msage=msage+"<tr>"; 
				msage=msage+"<th colspan='2'>县区</th>"; 
				msage=msage+"</tr>"; 
				msage=msage+"<tr>"; 
				msage=msage+"<td class='sec-th'>可服务区域</td> ";
				msage=msage+"<td>"+item.Value+"</td> ";
				msage=msage+"</tr> ";
				msage=msage+"<tr>"; 
				msage=msage+"<td class='sec-th'>不可服务区域</td>"; 
				msage=msage+"<td>"+item.Text+"</td>"; 
				msage=msage+"</tr>"; 
				msage=msage+" </table>"; 
				alertDialog('货到付款服务地区', msage,"",600,'auto');
			}
		});
	}	
	function addfun1_1(aProvince,aCity,aDistrict){
		var newCityArray = jQuery.grep(cityArray, function (item) { return item.When == aProvince; });
		$.each(newCityArray,function(index, item){
			if ( item.Value == aCity ){
				$("#city").attr("selectedIndex",index);
				
			}
		});
		setTimeout("addfun2('"+aProvince+"','"+aCity+"','"+aDistrict+"')",100);
	}
	function addfun2(bProvince,bCity,bDistrict){
		var startDistrict='';
		$("#district").find('option').remove().end();
		$.each(districtArray,function(index, item){
			if ( item.When == bCity){
				$("#district").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
				startDistrict=item.Text;
			}
		});
		setTimeout("addfun2_2('"+bProvince+"','"+bCity+"','"+bDistrict+"','"+startDistrict+"')",100);
	}
	function addfun2_2(cProvince,cCity,cDistrict,startDistrict){
		var newDistrictArray = jQuery.grep(districtArray, function (item) { return item.When == cCity; });
		$.each(newDistrictArray,function(index, item){
			var tmpDist=cDistrict;
			startDistrict=item.Text;
			if(cDistrict==startDistrict.substring(1)){
				if(startDistrict.substring(0,1)=='※'){
					//startDistrict=startDistrict.substring(1);
					if(parseFloat($("#finalTotalAmount").val())>10000){
						$("#paytype30").attr("disabled",true);
						$("#showOrderPriceLimit").html("(订单金额超过10000元，将不提供货到付款服务。)");
					}else{
						$("#paytype30").attr("disabled",false); 
					}
				}
			}
			if ( item.Value == tmpDist ){
				$("#district").attr("selectedIndex",index);
			}
		});
	}
	var isGoNext=false;

	function caleShipFare(tmpProvince,isBuyNowFlag,tmpFinalMustPay,addCmpPd,buyNowCartId){
		$.post("<%=ServerValue.getFrontContextPath()%>/shopping/orderInfo/getFreight.do",{codProvince:tmpProvince,isBuyNow:isBuyNowFlag,finalMustPay:tmpFinalMustPay,addCmpPd:addCmpPd,buyNowCartId:buyNowCartId},callback,"json");
		function callback(result){
			$("#spanFreight").text(result);
			$("#editShipFare").val(parseFloat(result).toFixed(1));
			ProcessCalcuTotal();
		}	
	}
	function chineseCount(word){
	    var length=0;
	    for(var cc=0;cc<word.length;cc++){
	       var c = word.charCodeAt(cc);
	      if (!(c>=32&&c<=126)) length++;
	    }
	    return length;
	}
	function reCalcBalance(){
		<%--帳戶餘額--%>
		var numChkVrtBlnc=parseInt($("#chkVrtBlnc").val(),10);
		if(numChkVrtBlnc==0){
			$("#subVrtlBlnc2").val(0.0);
			$("#chkVrtBlnc").val(0.0);  
			$("#subVrtlBlnc").attr("disabled",false); 
		}else{
			$("#subVrtlBlnc").attr("disabled",false); 
		} 
		<%--禮品卡--%>
		var numChkGiftCard=parseInt($("#chkGiftCard").val(),10);
		if(numChkGiftCard==0){
			$("#subGiftCard2").val(0.0);
			$("#chkGiftCard").val(0.0);  
			$("#subGiftCard").attr("disabled",false); 
		}else{
			$("#subGiftCard").attr("disabled",false); 
		}
	}
	<%--付款方式初始化--%>
	function initPaytype(){
		$("input[id^='paytype']").each(function(i){
			$(this).attr("disabled", false);
			$(this).attr("checked", false);
		});
		$("#allpaymsg").hide(); 
		ProcessCalcuTotal();
	}	
</script>
<s:form action="paymentInfo/paymentInfo.do" id="paymentInfoForm" name="paymentInfoForm" method="post">
<c-rt:if test="${isBuyNow=='true'}">
<input type="hidden" id="buyNowCartId" name="buyNowCartId" value="${cartOrders.cartId}"/>
</c-rt:if>
<div id="container">	
   <div id="main">
   <div class="order-step"><img src="/images/orderstep_2.gif" alt="订购步骤2_填写订购信息" /></div>
<div class="payment">
<!-- 選擇門市 -->
      <h3>选择取货门店</h3>
		<a href="#" id="notice"></a>
      <div class="atstore">
        <div class="area01">
          <p>目前达芙妮取货范围限定<strong>上海全区</strong></p>
          <p>
            <label>区域：</label>
            <select name="storeArea" id="storeArea">
              <option value="">请选择</option>
              <option value="卢湾区">卢湾区</option>
				<option value="普陀区">普陀区</option>
				<option value="青浦区">青浦区</option>
				<option value="松江区">松江区</option>
				<option value="宝山区">宝山区</option>
				<option value="长宁区">长宁区</option>
				<option value="虹口区">虹口区</option>
				<option value="黄浦区">黄浦区</option>
				<option value="闵行区">闵行区</option>
				<option value="南汇区">南汇区</option>
				<option value="闸北区">闸北区</option>
				<option value="奉贤区">奉贤区</option>
				<option value="金山区">金山区</option>
				<option value="嘉定区">嘉定区</option>
				<option value="杨浦区">杨浦区</option>
				<option value="静安区">静安区</option>
				<option value="浦东新区">浦东新区</option>
				<option value="徐汇区">徐汇区</option>
            </select><br/>
           <span id="storeAreaTip" class="msg rn" style="margin-left:3.5em;*margin-left:3.75em;_margin-left:1.87em"></span>
          </p>
          <p>
            <label>地址：</label>
            <select name="storeImage" id="storeImage">
              <option value="">请选择</option>
            </select><br/>
           <span id="storeImageTip" class="msg rn" style="margin-left:3.5em;*margin-left:3.75em;_margin-left:1.87em"></span>
          </p>
        </div>
        <div class="area02">
          <p>
            <label>取货门店：</label>
            <span id="pickStore">未选取</span>
            </p>
			<p>
			<span id="imagePreview">
			   <img src="/images/daphne/000.gif" />
			</span>		
			</p>
        </div>
      </div>
      <!-- 選擇門市 -->

    	<!-- 收货人 -->
        <h3>收货人信息 <span>(<b class="txt-rd">*</b>为必填项目)</span></h3>
         <div class="consignee">
            <ul>
              <li class="w-1of1"><label for="name"><span class="txt-rd">*</span> 姓    名：</label><span>     
              <input type="text"  class="txt-gy" name="contactName" id="contactName" value="" maxlength="20" size="16"/><br/>
              <span id="contactNameTip" class="msg rn" style="margin-left:7.9em;*margin-left:8.4em;">请填写姓名</span>
              </span></li>
                    <input type="hidden" id="province" name="province" value="上海"/>
                    <input type="hidden" id="city" name="city" value="上海市"/>
                    <input type="hidden" id="district" name="district" value=""/>
                    <input type="hidden" id="zipCode" name="zipCode" value=""/>
                    <input type="hidden" id="addr" name="addr" value=""/>
               		<input type="hidden" id="storeId" name="storeId" value="${storeId}"/>
               		<input type="hidden" id="storeAreaInit" name="storeAreaInit" value="${storeAreaInit}"/>
               		<input type="hidden" id="receiverData" name="receiverData" value="${receiverData}"/>
              <li class="c-f">
                <label for="tel"><span  class="txt-rd"></span>固定电话：</label>                
                <span> 
                <input type="text" name="areaCode" id="areaCode" value="" size="5" maxlength="4"/>-
		    <input type="text" name="phone" id="phone" value="" size="10" maxlength="10" maxlength="8"/>- 分机
 				<input type="text" name="extension" id="extension" value="" size="4" maxlength="8"/> 
                </span>&nbsp;<strong><span  class="txt-rd">*</span>手机号码：</strong>
                <input type="text" name="mobile" id="mobile"  value="" size="18" maxlength="11"/>
                <span class="txt-ss">&nbsp;(到货时，系统将以email及短信通知您取货时间。)</span> 
                <br/>
                <span id="telTip" class="msg rn" style="margin-left:3.5em;*margin-left:3.75em;_margin-left:1.87em">请至少填写一组电话</span>
                <span id="mobileTip" class="msg rn" style="margin-left:34.6em;*margin-left:35.3em;">请填写手机号码</span>
                
                </li>
              <li class="c-f">
             <c-rt:if test="${member.sendEmail=='xx'}">
	            <label for="tel"><span class="txt-rd">*</span>联络邮箱：</label>
	                <input id="mail" name="mail" value="" size="50" >
	                <span class="txt-ss">&nbsp;(您将会透过此邮箱接收订单进度通知信)</span>
	                <br/>
            		  <span id="mailTip" class="msg rn" style="display:block;">请填联络邮箱</span>
	                 </li>
             </c-rt:if>   
              <c-rt:if test="${member.sendEmail!='xx'}">
              <input id="mail" name="mail" value="${member.sendEmail}" type="hidden" size="50" >
               </c-rt:if> 
              
              <!-- <div><label>备    注：</label></div>
              <div>
              <textarea cols="25" rows="4" class="txt-gy" id="memo" name="memo"></textarea>            
              </div>
               -->                   
           </ul>
        </div>
       <!-- 配送方式 -->
          <h3>送货方式與运费说明</h3>
      <div class="send-way">
          <ul>
            <li class="w-1of3"><strong>运送方式：</strong>达芙妮门店取货</li>
            <li class="w-1of5"><strong>运费：<span class="txt-rd"><span id="spanFreight">0</span>元</span></strong>(重量总计${totalWeight }kg，<a href="#" id=payPortage>查看运费计算方式</a>)<br />
 			 <c:if test="${!empty campaignDiscount.orderinfoHtml}">
 				<br /><br /><p class="no-portage">${campaignDiscount.orderinfoHtml}</p> 
             </c:if> 
             
             </li>
          </ul>
      </div>
        <!-- 優惠方式 -->
          <h3>优惠折扣<c-rt:if test="${discountType eq 'single'}"><span>(礼券或购物金，请择一使用)</span></c-rt:if></h3>
        <div class="discount-way">
          <ul>
             <li class="w-1of1"><c-rt:if test="${discountType ne 'single'}"><strong>可选择多项：</strong></c-rt:if>
            <input type="hidden" id="showCpCode" name="couponInfo" value=""/>
             <input id="chkCoupon" name="chkCoupon" type="checkbox" value=""> 折扣礼券 (<a href="javascript:;" id="rechkCoupon" style="display:none;">重新选择礼券 |</a>  <a href="/help/3_coupons.html" target="_blank">礼券使用说明</a>)</li>
            <li class="w-1of1 pad-1">
            <c:if test="${overOneThousand=='N'}">
            <input id="chkBonus" name="chkBonus" type="checkbox" value=""> 
           使用 <span id="offsetBonus">0</span> 积分折抵<strong class="txt-rd" id="offset">0.0</strong> 元 / 目前共有 <strong class="txt-rd">${member.balance.bonusBalance}</strong> 积分（目 前${bonusCampaign.offsetRate} 积分可折抵 1 元，详见
            <a href="/help/3_coin.html#rule" target="_blank">积分使用说明</a> | 
            <a href="/help/3_coin.html#conversion" target="_blank">购物金积分转换说明</a>。）
            <input type="hidden" name="canUse" id="canUse" value="${canUse}">
            </c:if>
            <c:if test="${overOneThousand=='Y'}">
            本日已超过1000元购物金，无法使用购物金
            </c:if>
            </li>
          </ul>
	    </div>
			<!-- 付款方式 -->
			<h3>付款方式<span><img src="/images/icon_cart_360.gif" style="vertical-align:text-top" />与耀点100共同保护您的帐户安全</span></h3> 
			<div class="pay-way">
				<ul>
					<li class="w-1of1 pad-1"><input id="chkGiftCard" name="chkGiftCard" type="checkbox" value="0.0"> 用我的礼品卡 
						<input size="8" id="subGiftCard" name="subGiftCard"  value="" class="txt-rd" style="background-color:silver" readOnly /> 
						元来支付 / 目前我的礼品卡余额为<strong>￥<span id="myGiftCardBalance">${member.balance.giftcardBalance}</span>元</strong>
						<span id="useGiftCard" style="display:none;"><input type="button" id="confirmGiftCard" value="确认使用" name=""></span>
		    	</li>                
					<li class="w-1of1 pad-1"><input id="chkVrtBlnc" name="chkVrtBlnc" type="checkbox" value="0.0"> 用我的帐户余额 <input size="8" id="subVrtlBlnc" name="subVrtlBlnc"  value="" class="txt-rd" style="background-color:silver" readOnly />元来支付/目前我的帐户余额为<strong>￥<span id="myVirtualBalance">${member.balance.virtualBalance}</span>元</strong>  
						<span id="useWallet" style="display:none;"><input type="button" id="confirmWallet" value="确认使用"/></span>
					</li> 
					<li class="w-1of1 pad">订单金额：
						<strong class="txt-rd">￥ <span id="pFinalTotalAmount"></span> 元</strong> 
						(＝商品合计金额<strong> <span id="pTotalAmount"></span> 元</strong>+ 运费<span id="pShipFare"></span>元 － 礼券<span id="pCoupon"></span>元  - <span id="pOffsetBonus">0</span>积分折抵<span id="pBonus"></span>元  - 折扣<span id="pDiscount"></span>元  - 礼品卡<span id="pGiftCard">0.0</span>元 - 帐户余额<span id="pVirtualBalance">0.0</span>元 )               
					</li>					 
					<li class="w-1of1 cut-line">&nbsp;</li>
					<li class="w-pay">
						<strong>请选择付款方式：</strong>
						<div style="display:none;"><input id="paytype40" name="paytype" type="radio" value="40">  <strong>全额由我的帐户余额或礼券付清</strong></div>
						<div id="allpaymsg" style="display:none;"><strong class="txt-rd">本订单已由「帐户余额」付清全额，您不需再选择付款方式。</strong></div>
						<div><input id="paytype50" name="paytype" type="radio" value="50">  <strong>网上支付</strong></div>
						<div><p>支持以下银行借记卡及信用卡，需开通网银：</p></div>
						<div id="paytype_paytype50_1"><p><strong>银行支付：</strong></p></div>
						<div id="paytype_paytype50_2"><span class="sub-bank"><img src="/images/payment_banks.gif" alt="银行支付" /></span></div>
						<div><p><strong>第三方支付：</strong></p></div>
						<div>
							<span class="sub-bank">
								<c:if test="${member.applySource eq 'taobaomember' or member.applySource eq 'alipaymember'}">
									<img src="/images/payment_thirdparty_taobao.gif" alt="第三方支付" />
								</c:if>
								<c:if test="${member.applySource ne 'taobaomember' and member.applySource ne 'alipaymember'}">
									<img src="/images/payment_thirdparty.gif" alt="第三方支付" />
								</c:if>
							</span>
						</div>
						<c-rt:if test="${'on' eq useCreditcard}">
							<div id="paytype_paytype70"><input type="radio" id="paytype70" name="paytype" value="70"> <strong>信用卡单期支付</strong></div>
							<div><p>支持以下银行信用卡单期直付，无需开通网银：</p></div>
							<div><span class="sub-bank"><img alt="信用卡单期支付银行" src="/images/payment_card_single.gif"></span></div>
						</c-rt:if>				
						<div id="paytype_paytype20"><input type="radio" id="paytype20" name="paytype" value="20"> <strong>邮局汇款</strong> <span class="txt-gy">(至邮局柜台汇款)</span></div>
						<div id="paytype_paytype10"><input id="paytype10" name="paytype" type="radio" value="10"> <strong>银行转帐</strong> <span class="txt-gy">(至银行柜台汇款)</span></div>
						<div id="paytype_paytype30"><input id="" name="" type="radio" value="" disabled>  <strong>货到付款</strong> <span class="txt-rd">(<strong>达芙妮门店取货暂不支援</strong>)</span></div>   
            <c:if test="${member.applySource eq 'taobaomember'}">
							<script>$("#paytype_paytype20").hide();$("#paytype_paytype10").hide();$("#paytype_paytype30").hide();$("#paytype_paytype50_1").hide();$("#paytype_paytype50_2").hide();</script>
						</c:if>
					</li>
				</ul>
      </div>
       <!-- 发票信息 -->
          <h3>发票信息</h3>
	  <div class="pay-way">
    		 <ul>
	           <li class="w-pay">
	           <strong>发票：
	           			<input id="invotype01" name="invotype" type="radio" value="01">  <strong>个人</strong>
	 					<input id="invotype02" name="invotype" type="radio" value="02">  <strong>单位</strong> 
	 					<input size="20" type="text" name="invoTitle" id="invoTitle" value="" maxlength="40"/> 
	           </strong>
           </ul>
            <div class="paymentinvoice"> 
	           <span class="txt-gy">
	                      <p>注:普通发票因商品而异，随货寄送或于订单签收后10个工作日寄出。</p>
	                      <p>  企业客户若需增值税专用发票，<a href="/help/7_invoice.html" target="_blank">请向客服申请开具增值税发票。</a></p>
	            </span>
            </div>
      </div>
       <!-- 訂單明細close -->
       <div id="orderCartDetailClose">       
      <h3>订单明细<a id="orderCartToggleCloseName" href="javascript:;" class="a-more a-blue">开启订单明细</a></h3>
        <div  class="od-detail">
          <p class="total-1">本次订购共<span class="txt-rd">${cartOrders.productSum}</span> 项商品，实际应付总金额：
          <span class="txt-rd">￥<input type="text" id="closeFinalTotalAmount" value=""  class="show-money txt-L" readonly="true" size="14">元</span></p>
		</div>		
		</div>
        <!-- 訂單明細 -->	
      <c-rt:set var="campaigns" value=""/>
    <c-rt:forEach items="${cartOrders.applyCampaign }" var="campaign">
    	<c-rt:if test="${!empty campaigns}">
    	<c-rt:set var="campaigns">
    	${campaigns },${campaign.key }
    	</c-rt:set>
    	</c-rt:if>
    	<c-rt:if test="${empty campaigns}">
    	<c-rt:set var="campaigns">
    	${campaign.key }
    	</c-rt:set>
    	</c-rt:if>
    </c-rt:forEach>
    <input type="hidden" name="campaigns" value="${campaigns}"/>
        <!-- 訂單明細open-->
         <div id="orderCartDetailOpen">  
      <h3>订单明细<a id="orderCartToggleOpenName" href="javascript:;" class="a-more a-blue">关闭订单明细</a><a name="detail"></a></h3>
		<div class="od-detail d-show"> 
	    <table class="tb-3"> 
	        <thead> 
	          <tr> 
	            <th width="430">商品名称</th>
	            <th width="80">类型</th>
	            <th width="100">属性</th>
	            <th width="70">单价</th>
	            <th width="50">数量</th>
	            <th width="65">小计</th>
	          </tr> 
	        </thead> 
	        <tbody> 
	        
	        
	        
	        
	         <c-rt:forEach items="${cartOrders.cartOrderProducts }" var="op" varStatus="opStatus">
	         	
	       	<c-rt:if test="${op.prodTp=='2'}">
	       	 	<tr>
	            	<td colspan="5" align="left" class="table-in">
	            		<table border="0">
	                	<tr>
		                  <td width="430"><p>${op.prodName}</p></td>
		                  <td width="80"><span class="type-2">赠品</span></td>
		                  <td width="100">${op.prodSpecName}</td>
		                  <td width="70" class="txt-price">￥ ${pu:rmb(op.amount)}</td>
		                  <td width="50">${op.qty}</td>
		                </tr>
		               
	                </table>
		            </td>
	            	<td align="left" class="txt-price">￥ ${pu:rmb(op.totalPrice)}</td>
	            	<input type="hidden" id="editAmount_${rows_index.count}"  value="${op.totalPrice}"/>
	          	</tr>
	       	</c-rt:if>
						<c-rt:if test="${op.prodTp=='6'}">
	          	<tr>
	            	<td colspan="5" align="left" class="table-in">
	            		<table border="0">
	                	<tr>
		                  <td width="430"><p>${op.prodName}</p>
		                  <c-rt:forEach items="${cartOrders.cartOrderProducts}" var="cop">
	          	<c-rt:if test="${op.cartOrderProdId eq cop.cartOrderProdId}">

	          	<c-rt:forEach items="${cop.applyCampaign}" var="ac">
	          	
	          	<p>
	          	<c-rt:if test="${ac.active}">
	          		<span class="type-4">优惠</span>
	          	</c-rt:if>
	          	<c-rt:if test="${!ac.active}">
	          		<span class="type-6">优惠</span>（不符合）
	          	</c-rt:if>
	          	${pu:reqSet('pc', ac.campaign) }
	          	<a class="btn-promo" href="javascript:openCampaign('活动信息', compositeCampaign('${pu:replaceAll(pc.campaignName, '\'', '&#39;')}', '${pu:replaceAll(pc.campaignDetail, '\'', '&#39;')}', '${pu:replaceAll(pc.campaignDesc, '\'', '&#39;')}', '<fmt-rt:formatDate value="${pc.startDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>', '<fmt-rt:formatDate value="${pc.endDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>', '${pc.campaignUrl}'), 300, 'auto');">${ac.campaign.campaignName } </a>
	          <script>
					function openCampaign(title, content,width,height){
						openDialog(title, content,width,height);
						$( '#dialog').dialog('option', 'position', 'top' );
					}
				</script>
	          	</p>
	          	</c-rt:forEach>

	          	</c-rt:if>
	          </c-rt:forEach>
		                  </td>
		                  <td width="80"><span class="type-0">主商品</span></td>
		                  <td width="100">&nbsp;</td>
		                  <td width="70" class="txt-price">￥ ${pu:rmb(op.amount)}</td>
		                  <td width="50">1</td>
		                </tr>
		                <c-rt:forEach items="${op.details}" var="opd">
		               
		                	<c-rt:if test="${op.cartOrderProdId eq opd.cartOrderProdId and opd.detailTp == '6' and opd.prodId ne op.prodId}">
			                	<tr>
				                  <td width="430" class="txt-gy"><p>${opd.prodName}</p></td>
				                  <td width="80"><span class="type-4">活动</span></td>
				                  <td width="100" class="txt-gy">${opd.prodSpecName}</td>
				                  <td width="70">&nbsp;</td>
				                  <td  width="50" class="txt-gy">${opd.qty}</td>
			                	</tr>
			                	 <c-rt:set var="addOnSum">0</c-rt:set>
		                	</c-rt:if>
	                	</c-rt:forEach>
	                </table>
		            </td>
	            	<td align="left" class="txt-price">￥ ${pu:rmb(op.totalPrice)}</td>
	            	<input type="hidden" id="editAmount_${rows_index.count}"  value="${op.totalPrice}"/>
	          	</tr>
          	</c-rt:if>
         		<c-rt:if test="${op.prodTp=='0' or op.prodTp=='1' or op.prodTp == '7'}">
	          	<tr>
		            <td colspan="5" align="left" class="table-in">
		            	<c-rt:forEach items="${op.details}" var="opd">
		   
	          
				            <table border="0">
				            	<c-rt:if test="${opd.detailTp == '0' or opd.detailTp == '1' or opd.detailTp == '7'}">
				                <tr>
				                  <td width="430"><p>${opd.prodName}</p>
				                   <c-rt:if test="${op.prodId==timeLimitCartOrderProductList[0]}">
				                  	<p><span class="type-7">秒杀</span> 限时秒杀限会员购买</p>
				                  </c-rt:if>
				                  </td>
				                  <td width="80">
				                  	<c-rt:if test="${op.prodTp == '0' || op.prodTp == '7'}">
				                  		<c-rt:if test="${op.prodId!=timeLimitCartOrderProductList[0]}">
						                  	<c-rt:if test="${op.prodTp == '0' || op.prodTp == '7'}">
						                  		<span class="type-0">主商品</span>
						                  	</c-rt:if>	
						                  </c-rt:if>
				                  		  <c-rt:if test="${op.prodId==timeLimitCartOrderProductList[0]}">
						                  	<!--<span class="type-1">限购</span>-->
						                  </c-rt:if>
				                  	</c-rt:if>
				                  	<c-rt:if test="${op.prodTp == '1'}">
				                  		<span class="type-1">预购</span>
				                  	</c-rt:if>
				                  </td>
				                  <td width="100">${opd.prodSpecName}</td>
				                  <td width="70" class="txt-price">￥ ${pu:rmb(opd.amount)}</td>
				                  <td width="50">${opd.qty}</td>
				                </tr>
				                <input type="hidden" id="editAmount_${rows_index.count}"  value="${opd.amount*opd.qty}"/>
				                  <c-rt:set var="addOnSum">0</c-rt:set>
				               </c-rt:if>
				               <c-rt:if test="${opd.detailTp == '2'}">
					             	<tr>
				                  <td width="430" class="txt-gy"><p>${opd.prodName}</p></td>
				                  <td width="80"><span class="type-2">赠品</span></td>
				                  <td width="100" class="txt-gy">&nbsp;</td>
				                  <td width="70" class="txt-price">&nbsp;</td>
				                  <td width="50" class="txt-gy">${opd.qty}</td>
				               	</tr>
				               	 <c-rt:set var="addOnSum">0</c-rt:set>
				               </c-rt:if>
				               <c-rt:if test="${opd.detailTp == '3'}">
				               	<tr>
				                  <td width="430" class="txt-gy"><p>${opd.prodName}</p></td>
				                  <td width="80"><span class="type-3">加购</span></td>
				                  <td width="100" class="txt-gy">${opd.prodSpecName}</td>
				                  <td width="70" class="txt-price">￥ ${pu:rmb(opd.amount)}</td>
				                  <td width="50" class="txt-gy">${opd.qty}</td>
				                  <input type="hidden" id="editAmount_${rows_index.count}"  value="${opd.amount*opd.qty}"/>
				                  <c-rt:set var="addOnSum">${addOnSum + (opd.amount*opd.qty)}</c-rt:set>
			                 	</tr>
				               </c-rt:if>
				            </table>
				            
				            <c-rt:if test="${opd.detailTp ne '2' && opd.detailTp ne '3'}">
				                     	<c-rt:forEach items="${cartOrders.cartOrderProducts}" var="cop">
	          	<c-rt:if test="${opd.prodSpecId eq cop.prodSpecId}">
	          	

	          	<c-rt:forEach items="${cop.applyCampaign}" var="ac">
	          	
	          	<p>
	          	<c-rt:if test="${ac.active}">
	          		<span class="type-4">优惠</span>
	          	</c-rt:if>
	          	<c-rt:if test="${!ac.active}">
	          		<span class="type-6">优惠</span>（不符合）
	          	</c-rt:if>
	          	${pu:reqSet('pc', ac.campaign) }
	          	<a class="btn-promo" href="javascript:openCampaign('活动信息', compositeCampaign('${pu:replaceAll(pc.campaignName, '\'', '&#39;')}', '${pu:replaceAll(pc.campaignDetail, '\'', '&#39;')}', '${pu:replaceAll(pc.campaignDesc, '\'', '&#39;')}', '<fmt-rt:formatDate value="${pc.startDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>', '<fmt-rt:formatDate value="${pc.endDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>', '${pc.campaignUrl}'), 300, 'auto');">${ac.campaign.campaignName } </a>
	          	<script>
					function openCampaign(title, content,width,height){
						openDialog(title, content,width,height);
						$( '#dialog').dialog('option', 'position', 'top' );
					}
				</script>
	          	</p>
	          	</c-rt:forEach>

	          	</c-rt:if>
	          </c-rt:forEach>
	          </c-rt:if>
			            </c-rt:forEach>
			          </td>
			          <td align="left" class="txt-price">￥ ${pu:rmb( op.totalPrice)}</td>
			        </tr>
				     </c-rt:if>
				     <c-rt:if test="${op.prodTp=='5'}">
				     	<tr>
				     		<td colspan='5' align='left' class='table-in'>
					     		<table border='0'>
					     		<tr>
					     			<td width='430'><p>${op.prodName}</p></td>
					     			<td width='80'><span class='type-5'>满额购</span></td>
					     			<td width='100'>${op.prodSpecName}</td>
					     			<td width='70' class='txt-price'>￥ ${pu:rmb(op.amount)}</td>
					     			<input type='hidden' id='editAmount_x' value='${op.amount}'/>
					     			<td width='50'>1</td>
					     		</tr>
					     		</table>
				     		</td>
				     		<td align='left' class='txt-price'>￥ ${pu:rmb( op.totalPrice)}</td>
				     	</tr>
				     </c-rt:if>
				   </c-rt:forEach>
	        <%--
	        <c-rt:forEach items="${cartOrderProductList }" var="op" varStatus="opStatus">
	       	
						<c-rt:if test="${op.prodTp=='6N'}">
	          	<tr>
	            	<td colspan="5" align="left" class="table-in">
	            		<table border="0">
	                	<tr>
		                  <td width="500"><p>${op.prodName}</p></td>
		                  <td width="50"><span class="type-0">主商品</span></td>
		                  <td width="70">&nbsp;</td>
		                  <td width="85" class="txt-price">￥ ${pu:rmb(op.amount)}</td>
		                  <td width="50">1</td>
		                </tr>
		                <c-rt:forEach items="${cartOrderProductDetailList}" var="opd">
		               
		                	<c-rt:if test="${op.cartOrderProdId eq opd.cartOrderProdId and opd.detailTp == '6' and opd.prodId ne op.prodId}">
			                	<tr>
				                  <td width="500" class="txt-gy"><p>${opd.prodName}</p></td>
				                  <td width="50"><span class="type-4">活动</span></td>
				                  <td width="70" class="txt-gy">${opd.prodSpecName}</td>
				                  <td width="85">&nbsp;</td>
				                  <td  width="50" class="txt-gy">${opd.qty}</td>
			                	</tr>
			                	 <c-rt:set var="addOnSum">0</c-rt:set>
		                	</c-rt:if>
	                	</c-rt:forEach>
	                </table>
		            </td>
	            	<td align="left" class="txt-price">￥ ${pu:rmb(op.totalPrice)}</td>
	            	<input type="hidden" id="editAmount_${rows_index.count}"  value="${op.totalPrice}"/>
	          	</tr>
          	</c-rt:if>
         		<c-rt:if test="${op.prodTp=='0' or op.prodTp=='1'}">
	          	<tr>
		            <td colspan="5" align="left" class="table-in">
		            	<c-rt:forEach items="${cartOrderProductDetailList}" var="opd">
		            	
				            <table border="0">
				            	<c-rt:if test="${op.cartOrderProdId eq opd.cartOrderProdId and opd.detailTp == '0' or opd.detailTp == '1'}">
				                <tr>
				                  <td width="500"><p>${opd.prodName}</p></td>
				                  <td width="50">
				                  	<c-rt:if test="${op.prodTp == '0'}">
				                  		<span class="type-0">主商品</span>
				                  	</c-rt:if>
				                  	<c-rt:if test="${op.prodTp == '1'}">
				                  		<span class="type-1">预购</span>
				                  	</c-rt:if>
				                  </td>
				                  <td width="70">${opd.prodSpecName}</td>
				                  <td width="85" class="txt-price">￥ ${pu:rmb(opd.amount)}</td>
				                  <td width="50">${opd.qty}</td>
				                </tr>
				                <input type="hidden" id="editAmount_${rows_index.count}" value="${opd.amount*opd.qty}"/>
				                  <c-rt:set var="addOnSum">0</c-rt:set>
				               </c-rt:if>
				               <c-rt:if test="${op.cartOrderProdId eq opd.cartOrderProdId and opd.detailTp == '2'}">
					             	<tr>
				                  <td width="500" class="txt-gy"><p>${opd.prodName}</p></td>
				                  <td width="50"><span class="type-2">赠品</span></td>
				                  <td width="70" class="txt-gy">&nbsp;</td>
				                  <td width="85" class="txt-price">&nbsp;</td>
				                  <td width="50" class="txt-gy">${opd.qty}</td>
				               	</tr>
				               	 <c-rt:set var="addOnSum">0</c-rt:set>
				               </c-rt:if>
				               <c-rt:if test="${op.cartOrderProdId eq opd.cartOrderProdId and opd.detailTp == '3'}">
				               	<tr>
				                  <td width="500" class="txt-gy"><p>${opd.prodName}</p></td>
				                  <td width="50"><span class="type-3">加购</span></td>
				                  <td width="70" class="txt-gy">${opd.prodSpecName}</td>
				                  <td width="85" class="txt-price">￥ ${pu:rmb(opd.amount)}</td>
				                  <td width="50" class="txt-gy">${opd.qty}</td>
				                  <input type="hidden" id="editAmount_${rows_index.count}" value="${opd.amount*opd.qty}"/>
				                  <c-rt:set var="addOnSum">${addOnSum + (opd.amount*opd.qty)}</c-rt:set>
			                 	</tr>
				               </c-rt:if>
				            </table>
			            </c-rt:forEach>
			          </td>
			          <td align="left" class="txt-price">￥ ${pu:rmb(addOnSum + op.totalPrice)}</td>
			        </tr>
				     </c-rt:if>
				   </c-rt:forEach>
				   --%>
					</tbody>
  	    </table>
  	    <input type="hidden" id="addCmpPd" name="addCmpPd" value="${addCmpPd}"/> 
  	    <input type="hidden" id="addCmpPdId" name="addCmpPdId" value="${pu:split(addCmpPd, ',')[0] }"/>   
        <p class="total">本次订购共 <strong class="txt-rd">${cartOrders.productSum}</strong> 项商品，合计金额：<span>￥<input type="text" id="editTotalAmount" name="editTotalAmount" value=""  class="show-money txt-bk" readonly="readonly">元</span></p>
        <p class="total">＋运费：<span>￥<input type="text" id="editShipFare" name="editShipFare" value="0.0" class="show-money txt-bk" readonly="readonly">元</span></p>
        <p class="total">＋货到付款手续费：<span>￥<input type="text"  value="0.0" class="show-money txt-bk" readonly="readonly">元</span></p>
        <p class="total">－折抵优惠：<span>￥<input type="text" id="totalDiscount" name="totalDiscount" value="0.0" class="show-money txt-bk" readonly="readonly">元</span></p>
        <p class="total">－抵扣礼券：<span>￥<input type="text" id="editCoupon" name="editCoupon" value="0.0" class="show-money txt-bk" readonly="readonly">元</span></p>
				<p class="total">－折抵<strong class="txt-rd" id="editOffsetBonus">0</strong>积分：<span>￥<input type="text" id="editBonus" name="editBonus" value="0.0" class="show-money txt-bk" readonly="readonly">元</span></p>
        <div class="total-line">
	        <p class="total"><strong>订单金额：</strong><span>￥<input type="text" id="finalTotalAmount"  name="finalTotalAmount" value="0" class="show-money txt-bk" readonly="readonly" >元</span></p>
	        <p class="total">－礼品卡支付：<span>￥<input type="text" id="subGiftCard2" value="0.0" class="show-money txt-bk" readonly="readonly" >元</span></p>
	        <p class="total">－帐户余额支付：<span>￥<input type="text" id="subVrtlBlnc2" value="0.0" class="show-money txt-bk" readonly="readonly" >元</span></p>
				</div>
        <p class="total txt-m"><strong class="txt-rd">剩余应付金额：</strong>
        <strong class="txt-rd">￥<input type="text" id="finalMustPay" name="finalMustPay" class="show-money txt-L" readonly="readonly" size="14"/>元</strong></p>   			
    	</div>
    	 </div>
    	 <c-rt:if test="${needValidateNum}">
	    	 <div class="incode">
	    	 	<div class="incotitle">验证码：</div>
	    	 	<div class="incowrap">
	    	 		<input type="text" name="ccode" id="ccode" maxlength="6" class="ipt-w20" autocomplete="off">
	    	 		<img id="iv" name="iv"> <a href="#chImg" id="chang_image">换张图</a></div>
	    	 		<span style="display:block"><span id="codeTip" class="msg rn" style="display:none">请输入校验码</span></span>
	    	 	</div>
	    	 </div>
    	 </c-rt:if>    	 
        <!-- 訂單明細 -->
        <p class="btns"><a id="go_next" href="javascript:void(0);" class="btn-big-rd f-rt"><span>下一步</span></a>
        <c-rt:if test="${isBuyNow!='true'}">
        <a id="go_back" href="<%=ServerValue.getFrontContextPath()%>/shopping/cart.do" class="a-blue f-rt textlink" ><span>返回修改购物车</span></a>
        <input type="hidden" name="isBuyNow" id="isBuyNow" value="N_"/>
		</c-rt:if>
		<c-rt:if test="${isBuyNow=='true'}">
		<a id="go_back" href="<%=ServerValue.getFrontContextPath()%>/product/product.do?productId=<%=request.getParameter("itemNo")%>&z=<%=request.getParameter("categoryPath")%>" class="a-blue f-rt textlink" ><span>返回原商品页</span></a>
		<input type="hidden" name="isBuyNow" id="isBuyNow" value="Y_"/>
		</c-rt:if>
</p>  
  </div>
  </div> 
 <input type="hidden" name="ismobileVaild" id="ismobileVaild" value="${ismobileVaild}"/>
</s:form>
<div id="myCouponDialog"></div>
<div id="divPayArrive"></div>
<div id="divPayPortage"></div>
<div id="showWeightDialog"></div>

<div id="specialMessageDialog"></div>
<DIV id="dialog"></div>
<div id="chkProdInvDialog" title="库存不足" class="alert-caution" style="display: none;">
	<p id="resultDiv"></p>
	<div align="center">
		<span style="text-align: center;">
			<a href="javascript:;" id="mainProdNotEnough" class="btn-mid">回商品页</a>
		</span>
	</div>
</div>
<div id="chkPinvyDialog" title="赠品库存不足" class="alert-caution" style="display: none;">
	<p id="resultDiv"></p>
	<div align="center">
		<span style="text-align: center;">
			<a href="javascript:;" id="presentNotEnough" class="btn-mid">回商品页</a>
		</span>
	</div>
</div>
<div id="mobileVaildDialog"></div>